package com.freecloud.javabasics.design.state.simple;

import com.freecloud.common.LoggerUtil;

/**
 * @Author: maomao
 * @Date: 2020-03-18 20:56
 */
public class UnLoginState extends UserState {
    @Override
    public void favorite() {
        this.switch2Login();
        this.context.getState().favorite();
    }

    @Override
    public void comment(String comment) {
        this.switch2Login();
        this.context.getState().comment(comment);
    }

    private void switch2Login(){
        LoggerUtil.println("跳转到登陆页");
        this.context.setState(AppContext.STATE_LOGIN);
    }
}
